﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Heavy_Metals
{
    public partial class FXYXX_Duo_FX : Form
    {
        public FXYXX_Duo_FX()
        {
            InitializeComponent();
        }

        public DrawCurves dc = new DrawCurves();
        private void tabPage2_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Pen p = new Pen(Color.Blue, 2);
            dc.DrawCoordinate(g, p, 100, 180, 400, 150, 20, 20, 2.5, 5.0);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Graphics g = this.tabPage2.CreateGraphics();
            Pen p = new Pen(Color.Blue, 2);
            MessageBox.Show("预测成功", "操作提示");
            double perPicelY = 5.0 / 20;
            double[] data = { 10, 14, 16, 13, 13, 14, 14, 16,12,14,12,13,14,13,15 };
            dc.DrawCurve(g, p, "风险源1", new Point(15, 70), 100, 180, perPicelY, 20, data);
            double[] data1 = { 13, 15, 16, 17, 13, 16, 17, 12, 15, 13, 14, 16, 14,13,17 };
            Pen p1 = new Pen(Color.Black, 2);
            dc.DrawCurve(g, p1, "风险源2", new Point(15, 100), 100, 180, perPicelY, 20, data1);
        }

        private void FXYXX_Duo_FX_Load(object sender, EventArgs e)
        {

        }

        private void tabPage1_Paint(object sender, PaintEventArgs e)
        {
            DrawPieCharts dpc = new DrawPieCharts();
            DataTable dt = new DataTable();
            dt.Columns.Add("名称", System.Type.GetType("System.String"));
            dt.Columns.Add("数据", System.Type.GetType("System.Int32"));
            DataRow dr = dt.NewRow();
            dr["名称"] = "";
            dr["数据"] = 11;
            dt.Rows.Add(dr);
            Image image1 = dpc.Render("饼状图", "重金属比例", 240, 240, dt, 1);
            Graphics g = e.Graphics;
            g.DrawImage(image1, new Point(150, 0));
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DrawPieCharts dpc = new DrawPieCharts();
            DataTable dt = new DataTable();
            dt.Columns.Add("名称", System.Type.GetType("System.String"));
            dt.Columns.Add("数据", System.Type.GetType("System.Int32"));
            DataRow dr = dt.NewRow();
            dr["名称"] = "风险源1";
            dr["数据"] = 11;
            dt.Rows.Add(dr);
            DataRow dr1 = dt.NewRow();
            dr1["名称"] = "风险源2";
            dr1["数据"] = 16;
            dt.Rows.Add(dr1);
            Image image1 = dpc.Render("饼状图", "重金属比例", 240, 240, dt, 1);
            Graphics g = this.tabPage1.CreateGraphics();
            g.DrawImage(image1, new Point(150, 0));
        }
    }
}
